Class Functions and Instance Functions

Class Functions (cfunction)

A class function is a function that is applied to the class definition itself. It is most often used to create an object of the class. For example:

Sig = VRAMP.New("SIGNAL", Pstat, 1.0, 5.0, 0.010, 1.0)

New is a cfunction (class function) of class VRAMP. It is applied directly to the class name using syntax: VRAMP.New. The function New creates a new object of class VRAMP. This object is assigned to the local variable Sig. The actual interpretation of the parameters following the function is up to each class. A few classes have cfunctions besides New. These functions can affect all objects of that class. See the class definition for details about each class.

Instance Functions (ifunction)

Instance functions are the main tool for modifying or extracting data stored in an object. Some object-oriented languages call these things "messages". But because it behaves like a function, we call it a function.

Instance functions are applied to objects rather than classes. In the sample script:

Status = Crv.Run()

Crv is an object of class CURVE. Therefore ifunction Run() can be applied to it. There may be other ifunctions with the name Run() in other classes. However, Explain™ makes sure the correct Run() is used.

Instance functions may have parameters and return values (such as Status in the above example). Check the class definition.